package com.gxa.client_shoppings.service.impl;

import com.gxa.client_shoppings.mapper.ShoppingsMapper;
import com.gxa.client_shoppings.pojo.Shoppings;
import com.gxa.client_shoppings.service.ShoppingsService;
import com.gxa.client_shoppings.utils.JsonResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author smile_ZhongXuan
 * @Date 2020/11/13 10:06
 * @Version 1.0
 */
@Service("shoppingsService")
public class ShoppingsServiceImpl implements ShoppingsService {

    @Resource
    ShoppingsMapper shoppingsMapper = null;
    JsonResult jsonResult = new JsonResult();

    @Override
    public Integer addShopMessage(Shoppings shoppings) {
        return shoppingsMapper.insertSelective(shoppings);
    }

    @Override
    public Integer updateShopMessage(Shoppings shoppings) {
        return shoppingsMapper.updateByPrimaryKeySelective(shoppings);
    }

    @Override
    public List<Shoppings> listShopMessage() {
        return shoppingsMapper.selectAll();
    }

    @Override
    public Integer deleteShopMessage(Integer id) {
        Shoppings shoppings = new Shoppings();
        shoppings.setId(id);
        return shoppingsMapper.deleteByPrimaryKey(shoppings);
    }
}
